/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Grafik;

import ModulHåndtering.Modul;
import ModulHåndtering.Sensor;
import java.awt.Point;
import java.util.ArrayList;

/**
 *
 * @author Magnus
 */
public class Oversigt extends javax.swing.JPanel {

    MainSkærm ejer;
    Modul modul;

    public void setEjer(MainSkærm ejer) {
        this.ejer = ejer;
    }

    public void setModul(Modul modul) {
        this.modul = modul;
        grafTegning1.setModul(modul);
    }

    /**
     * Creates new form Oversigt
     */
    public Oversigt() {
        initComponents();
        grafTegning1.setEjer(this);
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        GrafDestination = new javax.swing.JFileChooser();
        jLabel1 = new javax.swing.JLabel();
        tilbageKnap = new javax.swing.JButton();
        grafTegning1 = new Grafik.GrafTegning();
        gemGraf = new javax.swing.JButton();
        åbenGraf = new javax.swing.JButton();

        setLayout(null);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setText("Graf");
        add(jLabel1);
        jLabel1.setBounds(240, 10, 50, 28);

        tilbageKnap.setText("Tilbage");
        tilbageKnap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tilbageKnapActionPerformed(evt);
            }
        });
        add(tilbageKnap);
        tilbageKnap.setBounds(40, 340, 130, 40);

        grafTegning1.setPreferredSize(new java.awt.Dimension(400, 300));
        add(grafTegning1);
        grafTegning1.setBounds(60, 40, 400, 300);

        gemGraf.setText("Gem graf");
        gemGraf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gemGrafActionPerformed(evt);
            }
        });
        add(gemGraf);
        gemGraf.setBounds(350, 340, 130, 40);

        åbenGraf.setText("Åbn Graf");
        åbenGraf.setActionCommand("Åben Graf");
        åbenGraf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                åbenGrafActionPerformed(evt);
            }
        });
        add(åbenGraf);
        åbenGraf.setBounds(190, 340, 130, 40);
    }// </editor-fold>//GEN-END:initComponents

    private void tilbageKnapActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_tilbageKnapActionPerformed
    {//GEN-HEADEREND:event_tilbageKnapActionPerformed
        //Denne knap tager dig tilbage til hovedPanel
        ejer.rykForest(ejer.hovedPanel);
    }//GEN-LAST:event_tilbageKnapActionPerformed

    private void gemGrafActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gemGrafActionPerformed
        ejer.butler.skrivTilFilDataPunkter(modul);
    }//GEN-LAST:event_gemGrafActionPerformed

    private void åbenGrafActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_åbenGrafActionPerformed
        GrafINytVindue grafINytVindue = new GrafINytVindue(ejer);
        grafINytVindue.setVisible(true);
    }//GEN-LAST:event_åbenGrafActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFileChooser GrafDestination;
    private javax.swing.JButton gemGraf;
    private Grafik.GrafTegning grafTegning1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton tilbageKnap;
    private javax.swing.JButton åbenGraf;
    // End of variables declaration//GEN-END:variables
}
